/*
	Splash screen 
*/
#include <hge.h>
#include <hgesprite.h>
#include "splash.h"
#include "menu.h"
#include "play.h"

bool Splash_Init()
{
	bgtex=hge->Texture_Load("resources/images/serious.jpg");
	if (!bgtex) return false;

	bgspr=new hgeSprite(bgtex,0,0,800,600);
	bgspr->SetBlendMode(BLEND_COLORMUL| BLEND_ALPHABLEND | BLEND_NOZWRITE);
	return true;
}

bool Splash_Clean()
{
	delete bgspr;
	hge->Texture_Free(bgtex);
	return true;
}

bool Splash_Frame()
{
	float time = hge->Timer_GetTime();

	if ((hge->Input_KeyDown(HGEK_SPACE)) || (time>2.0f)){
		Splash_Clean();
		Menu_Init();
		hge->System_SetState(HGE_FRAMEFUNC, Menu_Frame);
		hge->System_SetState(HGE_RENDERFUNC, Menu_Render);
		return false;
	}

	return false;
}

bool Splash_Render()
{
	hge->Gfx_BeginScene();
	hge->Gfx_Clear(0);
	bgspr->Render(0,0);
	hge->Gfx_EndScene();

	return false;
}
